package com.huawang.mdesign.model.service.util.reqif;

import com.huawang.mdesign.model.service.util.reqif.converter.DateConverter;
import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import com.thoughtworks.xstream.annotations.XStreamConverter;
import com.thoughtworks.xstream.annotations.XStreamOmitField;
import lombok.Getter;
import lombok.Setter;

import java.util.Date;

/**
 * This class holds metadata relevant to the Exchange Document content.
 *
 * @author xdl
 * @since 2023-04-04
 */
@Getter
@Setter
@XStreamAlias(ReqIFConstants.REQ_IF_HEADER)
public class ReqIFHeader {

    /**
     * Optional comment associated with the Exchange Document as a whole.
     */
    @XStreamAlias(ReqIFConstants.COMMENT)
    private String comment;

    /**
     * Time of creation of the exchange XML document in the format of the XML Schema data type “dateTime” which
     * specifies the time format as CCYY-MM-DDThh:mm:ss with optional time zone indicator as a suffix ±hh:mm.
     * <p>
     * Example: 2020-08-27T10:42:54
     */
    @XStreamAlias(ReqIFConstants.CREATION_TIME)
    @XStreamConverter(DateConverter.class)
    private Date creationTime;

    /**
     * Unique identifier for whole exchange XML document.
     */
    @XStreamAlias(ReqIFConstants.IDENTIFIER)
    @XStreamAsAttribute
    private String identifier;

    /**
     * Optional unique identifier of the repository containing the requirements that have been exported.
     * Examples for repositoryID: databaseId, URL.
     */
    @XStreamAlias(ReqIFConstants.REPOSITORY_ID)
    private String repositoryId;

    /**
     * Identifier of the exporting ReqIF tool.
     */
    @XStreamAlias(ReqIFConstants.REQ_IF_TOOL_ID)
    private String reqIFToolId;

    /**
     * ReqIF interchange format and protocol version.
     */
    @XStreamAlias(ReqIFConstants.REQ_IF_VERSION)
    private String reqIFVersion;

    /**
     * Identifier of the exporting requirements management tool.
     */
    @XStreamAlias(ReqIFConstants.SOURCE_TOOL_ID)
    private String sourceToolId;

    /**
     * Title of the Exchange Document.
     */
    @XStreamAlias(ReqIFConstants.TITLE)
    private String title;

    @XStreamOmitField
    private ReqIF documentRoot;
}
